#ifndef HLISP_H
#define HLISP_H

#include <stdio.h>

#define MK_LIST3(a,b,c) (cell)cons(a, cons(b, cons(c, mk_eol())))
#define caar(a) (ecar(car(a)))
#define cadr(a) (ecar(cdr(a)))
#define cdar(a) (ecdr(car(a)))
#define cddr(a) (ecdr(cdr(a)))
#define caaar(a) (ecar(ecar(car(a))))
//...
#define cadar(a) (ecar(ecdr(car(a))))
#define caddr(a) (ecar(ecdr(cdr(a))))
#define cdaar(a) (ecdr(ecar(car(a))))
//...
#define cdddr(a) (ecdr(ecdr(cdr(a))))
//...
#define cadddr(a) (ecar(ecdr(ecdr(cdr(a)))))
//...

typedef void** cell;
typedef cell (*dvs_func)(cell);

#include "gc.h"

unsigned int funcp(cell c);
cell lisp_read(FILE* in);
int lisp_print(cell c, FILE* out);
cell dvs_error(char* message);
cell eval(cell l, cell env);
cell mk_env();
void add_to_env(cell env, cell sym, cell value);
void init_eval();

int list_length(cell l);
int listp(cell c);

cell mk_default_env();


extern unsigned int num_cons;
extern unsigned int DVS_ERROR_RETURN;
#endif //HLISP_H
